//
//  MEEditShapeScene.h
//  MapEditor
//
//  Created by Eric on 3/5/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MEBox2dLayer.h"
#import "MEPrototype.h"
#import "BBPackAction.h"
#import <map>

@interface MEEditShapeLayer : MEBox2dLayer {
    MEPrototype *prototype;
    NSInteger state;
    CCMenuItemFont *line;
    CCMenuItemFont *rect;
    CCMenuItemFont *circle;
    CCMenuItemFont *polygon;
    CCMenuItemFont *moveSpt;
    CCSprite* spt;
    
    NSMutableArray* shapes;    
    NSMutableArray* tmpShapePoints;
    CGPoint prePoint;
    CGPoint curPoint;
    
    BBPackAction* done;
    BBPackAction* cancel;
    
    std::map<int, b2Body*> segments_;
}
@property(nonatomic, retain)MEPrototype *prototype;
@property(nonatomic, retain)CCMenuItemFont* line;
@property(nonatomic, retain)CCMenuItemFont* rect;
@property(nonatomic, retain)CCMenuItemFont* circle;
@property(nonatomic, retain)CCMenuItemFont* polygon;
@property(nonatomic, retain)CCMenuItemFont* moveSpt;
@property(nonatomic, retain)NSMutableArray* shapes;
@property(nonatomic, retain)BBPackAction* done;
@property(nonatomic, retain)BBPackAction* cancel;
@property(nonatomic, retain)CCSprite* spt;

+(id)layer:(MEPrototype*)p done:(BBPackAction*)done cancel:(BBPackAction*)cancel;
-(CGPoint)bodyCenter;
-(void)resetBody;
@end
